<template>
  <div class="common-layout">
    <el-container>
      <el-aside class="left">
        <div class="left-nav">
          <h2 class="tit">推荐</h2>
          <ul>
            <li>
              <router-link to="/discovermusic/singer">推荐歌手</router-link>
            </li>
            <li>
              <router-link to="/discovermusic/singer/RuZhu">
                入驻歌手
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">华语</h2>
          <ul>
            <li @click="add($event)">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 7, c: '华语男歌手' },
                }"
              >
                华语男歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 7, c: '华语女歌手' },
                }"
              >
                华语女歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 7, c: '华语组合/乐队' },
                }"
              >
                华语组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">欧美</h2>
          <ul>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 96, c: '欧美男歌手' },
                }"
              >
                欧美男歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 96, c: '欧美女歌手' },
                }"
              >
                欧美女歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 96, c: '欧美组合/乐队' },
                }"
              >
                欧美组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">日本</h2>
          <ul>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 8, c: '日本男歌手' },
                }"
              >
                日本男歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 8, c: '日本女歌手' },
                }"
              >
                日本女歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 8, c: '日本组合/乐队' },
                }"
              >
                日本组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">韩国</h2>
          <ul>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 16, c: '韩国男歌手' },
                }"
              >
                韩国男歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 16, c: '韩国女歌手' },
                }"
              >
                韩国女歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 16, c: '韩国组合/乐队' },
                }"
              >
                韩国组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
        <div class="left-nav">
          <h2 class="tit">其他</h2>
          <ul>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 1, b: 0, c: '其他男歌手' },
                }"
              >
                其他男歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 2, b: 0, c: '其他女歌手' },
                }"
              >
                其他女歌手
              </router-link>
            </li>
            <li @click="add">
              <router-link
                :to="{
                  path: '/discovermusic/singer/Hyn',
                  query: { a: 3, b: 0, c: '其他组合/乐队' },
                }"
              >
                其他组合/乐队
              </router-link>
            </li>
          </ul>
        </div>
      </el-aside>
      <el-main class="right">
        <div class="right-div">
          <div class="btn">
            <h3 class="title">{{ router.query.c }}</h3>
          </div>
          <ul class="ml">
            <li @click="qie(-1)" class="mll qie">
              <a href="#">热门</a>
            </li>
            <li @click="qie('a')"><a href="#">A</a></li>
            <li @click="qie('b')"><a href="#">B</a></li>
            <li @click="qie('c')"><a href="#">C</a></li>
            <li @click="qie('d')"><a href="#">D</a></li>
            <li @click="qie('e')"><a href="#">E</a></li>
            <li @click="qie('f')"><a href="#">F</a></li>
            <li @click="qie('g')"><a href="#">G</a></li>
            <li @click="qie('h')"><a href="#">H</a></li>
            <li @click="qie('i')"><a href="#">I</a></li>
            <li @click="qie('j')"><a href="#">J</a></li>
            <li @click="qie('k')"><a href="#">K</a></li>
            <li @click="qie('l')"><a href="#">L</a></li>
            <li @click="qie('m')"><a href="#">M</a></li>
            <li @click="qie('n')"><a href="#">N</a></li>
            <li @click="qie('o')"><a href="#">O</a></li>
            <li @click="qie('p')"><a href="#">P</a></li>
            <li @click="qie('q')"><a href="#">Q</a></li>
            <li @click="qie('r')"><a href="#">R</a></li>
            <li @click="qie('s')"><a href="#">S</a></li>
            <li @click="qie('t')"><a href="#">T</a></li>
            <li @click="qie('u')"><a href="#">U</a></li>
            <li @click="qie('v')"><a href="#">V</a></li>
            <li @click="qie('w')"><a href="#">W</a></li>
            <li @click="qie('x')"><a href="#">X</a></li>
            <li @click="qie('y')"><a href="#">Y</a></li>
            <li @click="qie('z')"><a href="#">Z</a></li>
            <li @click="qie(0)" class="mll"><a href="#">其他</a></li>
          </ul>
          <ul class="lie">
            <li v-for="si in singerList" :key="si.id">
              <div class="li-div">
                <img v-lazy="`${si.picUrl}`" alt="" class="image" />
                <router-link
                  :to="{ path: '/artist', query: { id: si.id } }"
                  class="img-a"
                  :title="`${si.name}的音乐`"
                ></router-link>
              </div>
              <p>
                <router-link
                  :to="{ path: '/artist', query: { id: si.id } }"
                  :title="`${si.name}的音乐`"
                  class="p-a"
                  >{{ si.name }}</router-link
                >
                <router-link
                  :to="{ path: '/artist', query: { id: si.id } }"
                  :title="`${si.name}的音乐`"
                  class="right-a"
                  :class="`${si.accountId}`"
                >
                </router-link>
              </p>
            </li>
            <li v-for="si in singerLists" :key="si.id" class="xia-li">
              <p>
                <router-link
                  :to="{ path: '/artist', query: { id: si.id } }"
                  :title="`${si.name}的音乐`"
                  class="xia-a"
                  >{{ si.name }}</router-link
                >
                <router-link
                  :to="{ path: '/artist', query: { id: si.id } }"
                  :title="`${si.name}的音乐`"
                  class="right-a2"
                  :class="`${si.accountId}`"
                ></router-link>
              </p>
            </li>
          </ul>
        </div>
      </el-main>
    </el-container>
  </div>
</template>

<script lang="ts">
export default {
  name: "HYN",
};
</script>

<script lang="ts" setup>
import { useRoute } from "vue-router";
import { ref, onMounted } from "vue";
import { singerApi, singerRZApi } from "@/api/api/singer";

const singerList = ref<any>([]);
const singerLists = ref<any>([]);
const router = useRoute();

const a = router.query.a;
const b = router.query.b;
onMounted(async () => {
  const res = await singerRZApi(-1, a, b);
  // console.log(router.query);

  singerList.value = res.artists.slice(0, 10);
  singerLists.value = res.artists.slice(10);
});
const add = async (event: any) => {
  const a = router.query.a;
  const b = router.query.b;
  const res = await singerRZApi(-1, a, b);
  singerList.value = res.artists.slice(0, 10);
  singerLists.value = res.artists.slice(10);

  console.log(event.path[1]);
};
const qie = async (x: any) => {
  const res = await singerRZApi(x, a, b);

  singerList.value = res.artists.slice(0, 10);
  singerLists.value = res.artists.slice(10);
};
</script>

<style scoped>
.common-layout {
  width: 980px;
  margin: 0 auto;
}
.left {
  width: 185px;
  padding: 0 10px 40px;
  padding-top: 40px;
  border-left: 1px solid #d3d3d3;
  border-right: 1px solid #d3d3d3;
}
.left-nav {
  width: 160px;
  padding-bottom: 10px;
  margin: 5px 0 0;
  padding-top: 16px;
  border-bottom: 1px solid #d3d3d3;
}

.left li a {
  display: inline-block;
  width: 160px;
  padding-left: 27px;
  font-size: 12px;
  height: 29px;
  line-height: 29px;
  background: url(../../image/cbb4e885-fa39-4f4a-9eef-42ed4a9b3fe1.png)
    no-repeat 0 -30px;
}
.left .TJ a {
  color: red;
  border: 1px solid #d3d3d3;
  background: url(../../image/cbb4e885-fa39-4f4a-9eef-42ed4a9b3fe1.png)
    no-repeat 0 0px;
}
.left li:active {
  color: red;
  border: 1px solid #d3d3d3;
  background: url(../../image/cbb4e885-fa39-4f4a-9eef-42ed4a9b3fe1.png)
    no-repeat 0 0px;
}
.tit {
  height: 25px;
  padding-left: 14px;
  font-size: 16px;
}

.right {
  padding: 30px;
  border-right: 1px solid #d3d3d3;
}
.btn {
  height: 40px;
  border-bottom: 2px solid #c20c0c;
}

.right .right-div .lie {
  margin: 20px 0 0 -20px;
}
.right .right-div li {
  width: 130px;
  height: 154px;
  display: inline-block;
  overflow: hidden;
  line-height: 2;
  margin-left: 20px;
  margin-bottom: 15px;
}
.right .right-div .ml {
  margin-top: 15px;
  margin-left: -15px;
}

.right .right-div .ml li {
  font-size: 14px;
  width: 10px;
  height: 30px;
  display: inline;
  overflow: hidden;
  line-height: 2;
  margin-left: 15px;
  /* float: left; */
}
.right .right-div .ml .mll {
  font-size: 12px;
}
.right .right-div .ml .qie {
  padding: 10px;
  border-radius: 10%;
  color: #fff;
  background-color: red;
}
.title {
  float: left;
  font-size: 24px;
  font-weight: normal;
}
.li-div {
  width: 130px;
  height: 130px;
  position: relative;
}
.img-a {
  background-position: 0 -680px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.right-div .p-a {
  float: left;
  max-width: 80%;
  font-size: 12px;
}
.right-a {
  margin-top: 5px;
  float: right;
  display: block;
  width: 15px;
  height: 15px;
  background-color: red;
  border-radius: 50%;
}
.right .right-div .list {
  margin-left: 20px;
  border-top: 1px solid red;
}

.right .right-div .list li {
  margin-left: 15px;
  height: 0;
  overflow: visible;
}
.right .right-div .list li .right-a {
  float: left;
}

.image {
  width: 100%;
  height: 100%;
}

.right .right-div .xia-li {
  width: 130px;
  height: 20px;
  display: inline-block;
  overflow: hidden;
  line-height: 2;
  margin-left: 20px;
  margin-bottom: 15px;
}
.right-div .xia-a {
  float: left;
  max-width: 80%;
  font-size: 12px;
}
.right-a2 {
  margin-top: 5px;
  float: left;
  display: block;
  width: 15px;
  height: 15px;
  background-color: red;
  border-radius: 50%;
}

.undefined {
  display: none;
}
</style>
